package com.chen.utils;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;

@Data
@ToString
@AllArgsConstructor
@NoArgsConstructor
public class Result {
    private boolean success;

    private Integer code;

    private String msg;

    private Object data;

    private Object pageParams;

    public static Result success(Object data) {
        return new Result(true,200,"success",data,null);
    }
    public static Result fail(Integer code, String msg) {
        return new Result(false,code,msg,null,null);
    }

    public static Result custom(boolean success,Integer code,String msg,Object data) {
        return new Result(success,code,msg,data,null);
    }

    public static Result successPage(Object data, Object pageParams){
        return new Result(true,200,"success",data,pageParams);
    }
}
